/* Copyright (c) Oracle Corporation 1992.  All Rights Reserved */

/*****************************************************************************
  NAME
    orainst.ins - Windows 95 V3 Installation Install Script

  DESCRIPTION
    This script installs the NT installer.

  MODIFIED   MM/DD/YY REASON
    sagarwal 09/28/95 Added WIN95.SHD to a_list
    sagarwal 09/12/95 Added path.vrf; removed services.vrf
    sagarwal 07/11/95 Created from NT's ORAINST.INS
*****************************************************************************/

{
  if (doit)
    {
      overwrite_mode = 'ALWAYS;
      permit_retry_operations = TRUE;

      ui_product(product_label);

      inst_dir = "%oracle_home%\ORAINST";
      backup_dir = "%inst_dir%\backup";
      backup_marker = "%inst_dir%\backup.mk";
      if (exists(backup_marker))
	{
	  /* at this point, backup files are not valid */
	  remove_file(backup_marker);
	  a_list = list("WIN95.AVF", "WIN95.VRF", "WIN95.PVF",
			"WIN95.INS", "WIN95.DEI", "WIN95.PIN", 
			"WIN95.SHD", "PATH.VRF",  "MAKEDIR.VRF");
	  {
	    while (not(empty(a_list))) 
	      {
		the_file = first(a_list);
		a_list = rest(a_list);
		remove_file("%backup_dir%\%the_file%");
	      }
	    remove_directory(backup_dir);
	  } [ 'default: continue(); ]
	}

      /* Remove any resource files from %oracle_home%\DBS */

      old_resources = files("%oracle_home%\DBS\OI*.RES");

      while (not(empty(old_resources)))
        {
          the_file = first(old_resources);
          remove_file(the_file);
          old_resources = rest(old_resources);
        }


      ui_action("Installing %product_label% Executables...");
      copy(exec);

      ui_action("Installing %product_label% Resources...");
      copy(res);

      ui_action("Installing %product_label% Installation Scripts...");
      copy(script);
      copy(deinstl);

      ui_action(recording_name);


      {
        {
	  if (exists("%oracle_home%\dbs\oi%nls_abbreviation%.res"))
            save_customer_name(the_customer_name,
			       "%oracle_home%\dbs\oi%nls_abbreviation%.res");
        }
	  [ 'WRITE_PROTECTED: signal('WRITE_ERROR); ]
      }
	[ 'WRITE_ERROR: signal('FAILURE,instantiate(recording_name_error1)); ]

      {
	{
	  if (nls_abbreviation != "us")
	    save_customer_name(the_customer_name,
			       "%oracle_home%\dbs\oius.res");
	}
	  [ 'WRITE_PROTECTED: signal('WRITE_ERROR); ]
      }
	[ 'WRITE_ERROR: signal('FAILURE,instantiate(recording_name_error2)); ]


      register(current_product);
      reference(current_product);
      
      permit_retry_operations = FALSE;

    }
}
